<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <div id="root">
        <h1>{{msg}}</h1>
        <my-comp>
            <template v-slot:header="{user}">
                <h2>头部:{{user.name}}</h2>
            </template>  
            <template v-slot:middle>
                <h2>中间</h2>
            </template>
          <template v-slot:bottom>
            <h2>尾部</h2>
          </template>
        </my-comp>
    </div>

    <script src="./vue.js"></script>
    <script>
        Vue.component("my-comp",{
            data:function(){
                return {
                    user:{
                        name:"tt-name"
                    }
                }
            },
            template:`
                <div>
                    
                    <slot name="bottom"></slot>
                    /* 作用域插槽 */
                    <slot name="header" :user="user"></slot>
                    <h2>my comp组件</h2>
                    <slot name="middle"></slot>
                </div>
            `
        })
        let vm1 = new Vue({
            el:"#root",
            data:{
                msg:"匿名插槽",

            }
        })

    </script>
</body>
</html>